package com.atguigu.flink.java.chapter_2;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.DataStreamSink;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @Author lizhenchao@atguigu.cn
 * @Date 2020/12/15 21:33
 */
public class ChainDemo {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI(new Configuration());
        env.setParallelism(2);
        env.disableOperatorChaining();
        DataStreamSink<String> resuot = env
          .socketTextStream("hadoop102", 9999)
          .filter(x -> true)
          .map(x -> x)
          .startNewChain()
          .setParallelism(2)
          .filter(x -> x.length() > 1)
          .map(x -> x)
          .print();

        System.out.println(env.getExecutionPlan());


        env.execute();
    }
}
